package com.aididi.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: zx.xu
 * @Description:
 */
@RestController
@RefreshScope   //支持配置动态刷新
public class HelloController {

    @Value("${server.port}")
    String port;

    @Value("${foo.bar}")
    String fooBar;


    @GetMapping("/hi")
    public String home(@RequestParam String name) {
        return "hi "+name+",i am from port:" +port;
    }

    @GetMapping("/foo")
    public String getFooBar() {
        return fooBar;
    }
}
